﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace frmPrincipal
{
    public partial class frmConClientes : Form
    {
        private int callWidth;
        private int callHeight;

        public frmConClientes()
        {
            this.callWidth = 400;
            this.callHeight = 300;

            InitializeComponent();
        }

        //Chama os respectivos formulários
        private void btnSearchAll_Click(object sender, EventArgs e)
        {
            frmConsultaBasica consulta;
            string title = "Consulta de Todos os Clientes";
            string sqlCommandText;

            sqlCommandText = "SELECT * FROM cliente "+
                    "ORDER BY nome_cliente";

            consulta = new frmConsultaBasica(title, sqlCommandText, callWidth, callHeight);
            consulta.Show();
        }
        private void btnSearchByName_Click(object sender, EventArgs e)
        {
            frmConPorNome consultaNome;         
            
            consultaNome = new frmConPorNome("Nome do Cliente:", "Consulta de Clientes por Nome", "cliente", "nome_cliente", callWidth, callHeight );
            consultaNome.Show();
        }
        private void btnSearchByCode_Click(object sender, EventArgs e)
        {
            frmConPorCodigo consultaCodigo;

            consultaCodigo = new frmConPorCodigo("CPF do Cliente:", "Consulta de Clientes por CPF", "cliente", "cpf", callWidth, callHeight);
            consultaCodigo.Show();
        }

        //Volta p/ frmConsultaPrincipal
        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
